{% extends "entities/simpleui_change_list_actions.html" %}
{% load i18n admin_urls static admin_list simpletags %}

{% block header %}
<script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
{% endblock %}

{% block content %}
    {{ block.super }}

    <script>console.log('============ 这是myLayer!')</script>

    <!-- 引入layer.js -->
    <script src="https://www.layuicdn.com/layui/layui.js"></script>
    <script>
        {#content: '/api/myHtml/show.html',   //iframe的url#}
        console.log('~~~~~~ aaaaaaaaa111');

        // 通过审核
        function pass_audit_obj(obj_id) {
            // 调用layer弹窗组件
            if (0){
                layer.open({
                    // 弹窗标题
                    title: "通过审核",
                    // 正文
                    content: "确认通过这篇文章吗？",
                    shadeClose: true,
                    // 点击确定按钮后调用的回调函数
                    yes: function(index, _layer) {

                        // 指定应当前往的 url
                        console.log('~~~ yes', index, _layer);
                        {#$('form#safe_delete button').click();#}
                        layer.close(index);
                    },
                });
            }
            else {
                change_is_pass_audit_text(obj_id);
            }
        }

        // 编辑
        function change_obj(obj_id) {
            console.log('======= change_obj obj_id', obj_id);

            // 调用layer弹窗组件
            if (0){
                layer.open({
                    // 弹窗标题
                    title: "编辑",
                    // 正文
                    content: "确认编辑这篇文章吗？",
                    // 点击确定按钮后调用的回调函数
                    yes: function(index, _layer) {
                        // 指定应当前往的 url
                        console.log('~~~ yes', index, _layer);
                        {#$('form#safe_delete button').click();#}
                        layer.close(index);
                    },
                });
            }
            if (0){
                var url = '/api/admin/flow_statistics/task/' + obj_id + '/change/'
                {#var url = '/api/template/pdfjs/web/viewer.html?' + file_url;   //iframe的url#}
                console.log('~~~ url', url);
                layer.open({
                    id: "son",
                    type: 2,
                    title: '个人信息展示',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['70%', '90%'],
                    content: url,
                });
            }
        }

        // 预览
        function preview_obj(obj_id) {
            console.log('======= obj_id', obj_id);
            // 调用layer弹窗组件
            if (0){
                layer.open({
                    // 弹窗标题
                    title: "确认删除?",
                    // 正文
                    content: "确认删除这篇文章吗？",
                    // 点击确定按钮后调用的回调函数
                    yes: function(index, _layer) {
                        // 指定应当前往的 url
                        console.log('~~~ yes', index, _layer);
                        {#$('form#safe_delete button').click();#}
                        layer.close(index);
                    },
                });
            }

            else {
                var file_url = 'file=..\\..\\doc\\333.pdf';
                var url = '/api/template/pdfjs/web/viewer.html?' + file_url;   //iframe的url

                console.log('~~~ url', url);
                layer.open({
                    id: "son",
                    type: 2,
                    title: '个人信息展示',
                    shadeClose: true,
                    shade: 0.8,
                    area: ['70%', '90%'],
                    content: url,
                });
            }
        }
    </script>

    <script>
        // 使用js实现局部更新
        function change_is_pass_audit_text(id) {
            var elem_3 = document.getElementById('is_pass_audit_' + id);
            {#console.log('--- elem_3: ', elem_3.textContent, elem_3.textContent == '否');#}
            elem_3.style="border-style:solid; border-width:1px;";

            var elem_active_button = document.getElementById('bdActiveButtonId_' + id);

            if (elem_3.textContent == '否'){
                elem_3.textContent = '是';
                elem_active_button.textContent = '撤销';
            }
            else {
                 elem_3.textContent = '否';
                 elem_active_button.textContent = '通过';
            }
            {#document.getElementById('is_pass_audit_1').style.display = 'none';#}
        }

    </script>
{% endblock %}


{#{% simpleui_admin_actions %}#}


{% block buttons_bd %}
    {{ block.super }}
    <a href="#" onclick="confirm_delete()">
        <button type="button" class="el-button el-button--default el-button--small"

                style="
                        float: right;
                        margin-bottom: 10px;
                        margin-top: 10px;
                        margin-right: 12px;"

                data-name="export_as_csv">
            <i class="fas fa-exclamation-circle"></i>
            <span>
                预览
            </span>
        </button>
    </a>
{% endblock %}

{#尝试获取内部list的变量#}
{#{% extends simpleui_admin_actions %}#}
{#123#}
{#{% endblock %}#}

